home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / faq / comp / motif_fa / part2 < prev    next >
Internet Message Format  |  1994-04-14  |  36KB

  1. Path: bloom-beacon.mit.edu!hookup!usc!howland.reston.ans.net!europa.eng.gtefsd.com!news.umbc.edu!cs.umd.edu!kong.gsfc.nasa.gov!kong.gsfc.nasa.gov!not-for-mail
  2. From: dealy@kong.gsfc.nasa.gov (Brian Dealy)
  3. Newsgroups: comp.windows.x.motif,news.answers,comp.answers
  4. Subject: Motif FAQ (Part 2 of 5)
  5. Followup-To: poster
  6. Date: 14 Apr 1994 15:20:34 -0400
  7. Organization: NASA/Goddard Space Flight Center
  8. Lines: 904
  9. Approved: news-answers-request@MIT.Edu
  10. Distribution: inet
  11. Expires: +1 months
  12. Message-ID: <2ok522$5ej@kong.gsfc.nasa.gov>
  13. Reply-To: dealy@kong.gsfc.nasa.gov (Brian Dealy)
  14. NNTP-Posting-Host: kong.gsfc.nasa.gov
  15. Keywords: FAQ question answer
  16. Xref: bloom-beacon.mit.edu comp.windows.x.motif:15726 news.answers:18058 comp.answers:4909
  17.  
  18.  
  19. Archive-name: motif-faq/part2
  20. Last-modified: APR 04, 1994
  21. Version: 3.6
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. -----------------------------------------------------------------------------
  30. Subject: 31)  TOPIC: MOTIF GENERATORS
  31.  
  32. -----------------------------------------------------------------------------
  33. Subject: 32)  What prototyping tools are there to generate Motif code?
  34.  
  35. [Last modified: June 93]
  36.  
  37. Answer: [An FAQ is for "personal opinions" on these tools.  I don't think it
  38. is appropriate to give such opinions through this particular posting, so I
  39. haven't included any. I will include vendor-provided descriptions provided
  40. they are consise and informative]
  41.  
  42. `Prototyping tools' come in two forms: those that can be used to design the
  43. interface only (GUI builder), and those that go beyond this to give support
  44. for application code (User Interface Management Systems).  There are a number
  45. of commercial and non-commercial tools of both kinds that will support the
  46. Motif interface.  They include:
  47.  
  48. GUI builders:
  49.  
  50. Builder Xcessory
  51. iXBUILD (formerly X Build)
  52. ExoCODE/xm
  53. MOTIFATION
  54. X-Designer
  55. Druid
  56.  
  57.  
  58. UIMS:
  59.  
  60. WINTERP
  61. ALEX
  62. TAE Plus
  63. Widget Creation Library
  64. UIMX
  65. Serpent
  66. TeleUse
  67. XFaceMaker2
  68. MetaCard
  69. ezX User Interface Management System
  70.  
  71.  
  72. Some contact addresses are:
  73.  
  74.  
  75.  
  76. TAE Plus: Don Link, Century Computing, Inc. (301) 953-3330 tae-facts@cen.com
  77.  
  78. TAE Plus is a mature, portable software development environment that supports
  79. rapid building, tailoring, and management of Motif-based graphical user
  80. interfaces.  The code generator can produce C, C++ and Ada code and allows for
  81. merging regenerated code with previously modified parts of the interface.  You
  82. an also generate a UIL/Mrm representation of your interface.  Scripting
  83. capabilities are provided which facilitate automatic testing, on-line demos,
  84. and tutorials.  A record and playback feature lets you build scripts simply by
  85. interacting with your GUI.  A library of Dynamic Data Objects allows the user
  86. to create truly graphical objects whose dynamic portions can reflect data as
  87. well as be directly manipulated by the end-user. TAE Plus is available on
  88. virtually all the standard X platforms and comes with a wide array of support
  89. vehicles. (i.e., support office, newsletter, user's conference, etc.)
  90.  
  91. WINTERP: You may obtain the current source, documentation, and examples via
  92. anonymous ftp from host export.lcs.mit.edu: in directory contrib/winterp you
  93. will find the compress(1)'d tar(1) file winterp.tar.Z. If you do not have
  94. Internet access you may request the source code to be mailed to you by sending
  95. a message to winterp-source%hplnpm@hplabs.hp.com or hplabs!hplnpm!winterp-
  96. source.
  97.  
  98. Serpent: The S/W is free (anonymous ftp) from ftp.sei.cmu.edu.  For more info
  99. contact erik/robert at serpent-info@sei.cmu.edu.  This is no longer supported,
  100. and is apparently replaced by a commercial product called Alpha.  TeleUSE:
  101. Built around X Windows and OSF/Motif, TeleUSE's comprehensive toolset gives
  102. you maximum control over every phase of graphical user interface development,
  103. including static screen layout and design, automatic implementation of
  104. callbacks, building the executable, and the interactive test, debug, and
  105. maintenance cycles.
  106.  
  107. For more information, please contact:
  108.  
  109. In North America and countries not specified below:
  110.  
  111. Alsys (formerly TeleSoft)
  112. 10251 Vista Sorrento Parkway Suite 300
  113. San Diego, CA 92121 USA
  114.  
  115. (619) 457-2700 X244
  116. (619) 452-1334 (fax)
  117. leigh@alsys.com
  118.  
  119. In France: +33 1 47 66 21 83
  120. In the UK: +49 491 579 090
  121. In Scandinavia: +46 8 520 69010
  122. In the Benelux: +31 15 62 21 21
  123. In Germany: +49 7531 65022
  124. In Italy: +39 6 5045 1
  125. In Japan: +81 3 522 85620
  126. In South Korea: +82 2 577 2044
  127.  
  128.  
  129.  
  130. Builder Xcessory from ICS.  More details are available by sending a request to
  131. info@ics.com.  Address: ICS Inc., 201 Broadway, Cambridge MA 02139, Tel. (617)
  132. 621-0060, Fax. (617) 621-9555
  133.  
  134. X-Designer: From Imperial Software Technology in the UK.  Email address is
  135. sales@ist.co.uk.  (+44) 743 587055
  136.  
  137. Recently, V.I. Corporation have become the distributor for the X-Designer
  138. product in the United States.  In addition, IST and V.I. Corporation have
  139. developed a product called DVX-Designer that merges X-Designer with their GUI
  140. product called DataViews.  Other merged products are in the works.  For more
  141. information, people can contact:
  142.  
  143.         V.I. Corporation
  144.         47 Pleasant Street
  145.         Northampton, MA  01060
  146.         Phone: (413) 586-4144
  147.         Fax: (413) 586-3805
  148.         Email: vi@vicorp.com
  149.  
  150. ExoCODE/xm: From Expert Object Corp., 7250 Cicero Avenue, Lincolnwood, IL
  151. 60646 (708)676-5555.
  152.  
  153. X Build: iXOS Software GmbH, Bretonischer Ring 12,
  154.         8011 Grasbrunn/Munich,
  155.         Germany,
  156.         email support@ixos.de or office@ixos.de,
  157.         phone ++49-89-46005 0
  158.  
  159. or in the US
  160.  
  161.         UniPress Software,
  162.         2025 Lincoln Hwy.,
  163.         Edison, NJ 08817,
  164.         phone 1-800-222-0550
  165.  
  166. ExoCode: From EXOC (Chicago, IL)
  167.  
  168. UIMX: Visual Edge Software Limited, 3870 Cote Vertu, St Laurent, Quebec, H4R
  169. 1V4, Phone: (514) 332-6430, Fax:   (514) 332-5914, or: Visual Edge Software
  170. Ltd., 101 First Street, Suite 443, Los Altos, CA 94022, Phone: (415) 948-0753,
  171. Fax:   (415) 948-0843
  172.  
  173. The Widget Creation Library: The distribution is available in several ways.
  174. The preferred approach it for you to get the compressed tar file using
  175. anonymous ftp from:
  176.  
  177.     export.lcs.mit.edu    (18.30.0.238) /contrib/Wcl.1.06.tar.Z
  178.  
  179.  
  180. XFaceMaker2: NSL -  Non Standard Logics S.A., 57-59, rue Lhomond, 75005  Paris
  181. - France, Phone: +33 (1) 43.36.77.50, Fax:   +33 (1) 43.36.59.78 email:
  182. requests@nsl.fr or requests%nsl.fr@inria.fr for information.
  183.  
  184. Their North American office: Non Standard Logics, Inc., 4141 State Street,
  185. Suite B-11, Santa Barbara CA 93110, Tel: 805 964 9599, Fax: 805 964 4367
  186.  
  187.  
  188. MOTIFATION: PEM GmbH, Vaihinger Strasse 49, 7000 Stuttgart 80, Germany, Tel:
  189. +49 (0) 711 713045, Fax: +49 (0) 711 713047 Email: basien@pem-stuttgart.de.
  190. Available for (Motif 1.2/1.1) on SunOS, Solaris 2.1, HP, Interactive, ODT 3.0,
  191. Silicon Graphics, PCS, ...
  192.  
  193.  
  194. ALEX: For more information contact Michael Karliner on (+44) 81 566 2307 or
  195. E-mail to alex@s-strat.co.uk.  ALEX Technologies, Waterman's Yard, 32a The
  196. Mall, Ealing, London W5, UK.
  197.  
  198. MetaCard: MetaCard 1.0 is supported on five popular UNIX/X11 platforms: SPARC,
  199. Sun3, DECstation, HP-9000/300, and SCO ODT.  An HP-9000/700 port is underway
  200. and should be available by the end of July.  [They] plan to support IBM
  201. RS/6000, SGI Iris, and DG AViiON sometime fall '92.  For more information, or
  202. to receive a free save-disabled but licensable copy of MetaCard, email to
  203. info@metacard.com or call 303- 447-3936.  If you have anonymous FTP access to
  204. the Internet, you can download the current engines, documentation, and an
  205. unlicensed Home stack from ftp.metacard.com (128.138.213.21), directory
  206. MetaCard.  Commercial users can get MetaCard from world.std.com
  207. (192.74.137.5), directory pub/Metacard.  If you don't have an anonymous ftp
  208. access, you can also download MetaCard from The World using kermit or xmodem
  209. from the ~ftp/pub/MetaCard directory.  Sign up by calling 617-739-0202 (voice)
  210. or via modem by dialing 617-739-9753 (7 bits even parity) and logging in as
  211. new.
  212.  
  213. MetaCard 1.2 Beta 5 is now available for anonymous FTP from ftp.metacard.com
  214. (directory MetaCard/1.2B5), and ftp.uu.net (directory vendor/MetaCard/1.2B5).
  215.  
  216. There is also a MetaCard mailing list.  To subscribe to the metacard-list,
  217. send mail to listserv@grot.starconn.com with the following commands in the
  218. body of the message:
  219.  
  220.       subscribe metacard-list firstname lastname
  221.       quit
  222.  
  223.  
  224. Replace "firstname lastname" with your name, not your e-mail address.
  225.  
  226.  
  227.  
  228. ezX User Interface Management System
  229. Sunrise Software, International
  230. 170 Enterprise Center
  231. Middletown, RI 02840
  232. 401-847-7868
  233. email: support@sunrise.com
  234.  
  235.  
  236.  
  237. WKSH (Windowing Korn Shell):
  238.  
  239.    EXtensible Korn Shell (C language calling interface,
  240.                           dynamic library loading, etc.)
  241.    Motif or OpenLook API
  242.    X Toolkit Intrinsics
  243.    WKSH Convenience Functions
  244.    Fast Learning and Prototyping Feature (ksh interpreter)
  245.  
  246.  
  247. Contact:
  248.    Acacia Computer,
  249.    PO Box 4376,
  250.    Warren, NJ 07059,
  251.    Phone: 908 548 6955,
  252.    Email: uunet!aca1
  253.  
  254. or
  255.  
  256. Computer Aid Inc, 1-(800)-444-WKSH
  257.  
  258. or
  259.  
  260. Consensys Corp, Europe: +(44)-734-833241 (Roger Chalke), +(44)0734-835391
  261. (Fax), US: (416)-940-2903, (416)-940-2903 (Fax).
  262.  
  263.  
  264. WKSH was developed by USL. Binaries are available through Acacia Computer for
  265. SUNOS, Solaris, SCO ODT, Intel SVR4.0
  266.  
  267.  
  268. Druid is a commercial product. It currently supports Motif1.1 and 4 unix
  269. platforms: SPARC, HP 9000, RS6000, and SGI.
  270.  
  271. For further information contact: Mr. Fred Lee, Automated Systems (Pte)
  272. Limited, 203 Henderson Road, #12-07/14, Henderson Industrial Park, Singapore
  273. 0315.  FAX: (65)272-2029
  274.  
  275. Or: Dr. Gurminder Singh (gsingh@iss.nus.sg), Institute of Systems Science,
  276. National University of Singapore
  277.  
  278.  
  279.  
  280.  
  281. -----------------------------------------------------------------------------
  282. Subject: 33)  TOPIC: TEXT WIDGET
  283.  
  284. -----------------------------------------------------------------------------
  285. Subject: 34) What is the difference between a XmTextField widget and a single
  286. line XmText widget?
  287.  
  288. Answer: Their functionality is the same, but the XmTextField is designed to
  289. give superior performance.  thanks to Ken Lee, klee@synoptics.com
  290.  
  291.  
  292. -----------------------------------------------------------------------------
  293. Subject: 35)  Why does  pressing  <return> in a text widget do nothing?  This
  294. happens using Motif 1.0 when I have a text widget inside a bulletin board (or
  295. form) inside a dialog shell. (In Motif 1.1 it is fixed for both text and list
  296. widgets.)
  297.  
  298. Answer: In single line mode, pressing the <return> key usually invokes the
  299. activate() action, and in multi-line mode, the newline() action.  However,
  300. whenever a widget is the child of a bulletin board widget which is the child
  301. of a dialog shell, the bulletin board forces all of its children to translate
  302. <return> to the bulletin board action Return() which is usually associated
  303. with the default button of the dialog.  To restore the text actions of
  304. activate() or newline(), you need to overide the Return() action of the
  305. bulletin board.
  306.  
  307.  
  308.         /* declarations */
  309.         /* for a single line widget */
  310.         char newTrans[] = "<Key>Return : activate()";
  311.         /* for a multi line widget */
  312.         char newTrans[] = "<Key>Return : newline()";
  313.         XtTranslations transTable;
  314.  
  315.         /* in executable section */
  316.  
  317.         transTable = XtParseTranslationTable(newTrans);
  318.  
  319.         /* after creating but before managing text widget */
  320.  
  321.         XtOverrideTranslations(textWidget, transTable);
  322.  
  323.  
  324. -----------------------------------------------------------------------------
  325. Subject: 36)  When I add text to a scrolling text widget how can I get the new
  326. text to show?
  327.  
  328. Answer: Use the call undocumented in Motif 1.0
  329.  
  330.         void XmTextShowPosition(w, position)
  331.         Widget w;
  332.         XmTextPosition position;
  333.  
  334. where the position is the number of characters from the beginning of the
  335. buffer of the text to be displayed. If you don't know how many characters are
  336. in the buffer, use another call undocumented in Motif 1.0
  337.  
  338.         position = XmTextGetLastPosition(w)
  339.  
  340.  
  341. -----------------------------------------------------------------------------
  342. Subject: 37)  Does the text widget support 16 bit character fonts?
  343.  
  344.  
  345. [Last modified: November 92]
  346.  
  347. Answer: R5 has support for 16 bit character sets, and Motif 1.2 uses that.
  348. Neither Motif 1.0 nor 1.1 support 16 bit sets.
  349.  
  350. -----------------------------------------------------------------------------
  351. Subject: 38)  How can I stop the text widget from echoing characters typed?  I
  352. need to turn off echo for password input.
  353.  
  354. Answer: Use the modifyVerifyCallback to tell when input is received. Set the
  355. `doit' field in the XmTextVerifyCallbackStruct to False to stop the echo. In
  356. Motif 1.0 this will cause a beep per character: Live with it, because at 1.1
  357. you can turn it off.  Note that password hiding is inherently insecure in X -
  358. someone may have an X grab on the keyboard and be reading all characters typed
  359. in anyway.
  360.  
  361. Another solution often proposed is to set the foreground and background
  362. colours to be the same, effectively hiding the text.  This has a major flaw:
  363. someone may select the text (triple click the mouse to get the line), and then
  364. paste the password into say an xterm with *different* foreground and
  365. background colours.  This immediately shows the password.
  366.  
  367. -----------------------------------------------------------------------------
  368. Subject: 39)  How can I replace characters typed with say a `*'?  I want to
  369. replace input for password entry.
  370.  
  371. [Last modified: April 93]
  372.  
  373. Answer: In Motif 1.1 Use the modifyVerifyCallback to tell when input is
  374. received.  Set text->ptr in the callback structure to '*'. This does not work
  375. under 1.0 because of an oversight in which changes to this are ignored.  In
  376. Motif 1.0, what you can do is set the doit flag to 'false' so the text is not
  377. displayed. Then set a static boolean to True to prevent re-entrance.  Next
  378. call XmTextReplace() to display your '*'.  then reset your re-entrance flag to
  379. False.  XmTextReplace() will call the XmNmodifyVerify callback.  To prevent
  380. getting into an infinite loop, you need the re-entrance flag.
  381.  
  382. The following program from Dan Heller illustrates this:
  383.  
  384. --------------
  385. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  386.  * This program is freely distributable without licensing fees and
  387.  * is provided without guarantee or warranty expressed or implied.
  388.  * This program is -not- in the public domain.  This program appears
  389.  * in the Motif Programming Manual, O'Reilly Volume 6.
  390.  */
  391.  
  392. /* passwd.c -- prompt for a passwd.  Meaning, all input looks like
  393.  * a series of *'s.  Store the actual data typed by the user in
  394.  * an internal variable.  Don't allow paste operations.  Handle
  395.  * backspacing by deleting all text from insertion point to the
  396.  * end of text.
  397.  */
  398. #include <Xm/Text.h>
  399. #include <Xm/LabelG.h>
  400. #include <Xm/RowColumn.h>
  401. #include <ctype.h>
  402.  
  403. void check_passwd();
  404. char *passwd; /* store user-typed passwd here. */
  405.  
  406. main(argc, argv)
  407. int argc;
  408. char *argv[];
  409. {
  410.     Widget        toplevel, text_w, rowcol;
  411.     XtAppContext  app;
  412.  
  413.     toplevel = XtVaAppInitialize(&app, "Demos",
  414.         NULL, 0, &argc, argv, NULL, NULL);
  415.  
  416.     rowcol = XtVaCreateWidget("rowcol",
  417.         xmRowColumnWidgetClass, toplevel,
  418.         XmNorientation, XmHORIZONTAL,
  419.         NULL);
  420.  
  421.     XtVaCreateManagedWidget("Password:",
  422.         xmLabelGadgetClass, rowcol, NULL);
  423.     text_w = XtVaCreateManagedWidget("text_w",
  424.         xmTextWidgetClass, rowcol, NULL);
  425.  
  426.     XtAddCallback(text_w, XmNmodifyVerifyCallback, check_passwd, NULL);
  427.     XtAddCallback(text_w, XmNactivateCallback, check_passwd, NULL);
  428.  
  429.     XtManageChild(rowcol);
  430.     XtRealizeWidget(toplevel);
  431.     XtAppMainLoop(app);
  432. }
  433.  
  434. void
  435. check_passwd(text_w, unused, cbs)
  436. Widget        text_w;
  437. XtPointer     unused;
  438. XmTextVerifyCallbackStruct *cbs;
  439. {
  440.     char *new;
  441.     int len;
  442.  
  443.     if (cbs->reason == XmCR_ACTIVATE) {
  444.         printf("Password: %s\n", passwd);
  445.         return;
  446.     }
  447.  
  448.     if (cbs->text->ptr == NULL) { /* backspace */
  449.         cbs->endPos = strlen(passwd); /* delete from here to end */
  450.         if (cbs->endPos <= 0) return; /* catch null passwd - Mark Scoville */
  451.         passwd[cbs->startPos] = 0; /* backspace--terminate */
  452.         return;
  453.     }
  454.  
  455.     if (cbs->text->length > 1) {
  456.         cbs->doit = False; /* don't allow "paste" operations */
  457.         return; /* make the user *type* the password! */
  458.     }
  459.  
  460.     new = XtMalloc(cbs->endPos + 2); /* new char + NULL terminator */
  461.     if (passwd) {
  462.         strcpy(new, passwd);
  463.         XtFree(passwd);
  464.     } else
  465.         new[0] = NULL;
  466.     passwd = new;
  467.     strncat(passwd, cbs->text->ptr, cbs->text->length);
  468.     passwd[cbs->endPos + cbs->text->length] = 0;
  469.  
  470.     for (len = 0; len < cbs->text->length; len++)
  471.         cbs->text->ptr[len] = '*';
  472. }
  473.  
  474.  
  475. -----------------------------------------------------------------------------
  476. Subject: 40)  How can I best add a large piece of text to a scrolled text
  477. widget?  In some versions of Motif 1.0 even using XmTextSetString, it insists
  478. on adding the text one line at a time, adjusting the scroll bar each time. It
  479. looks awful and is slow.
  480.  
  481. Answer: If you don't have this problem, use XmTextSetString to set all of the
  482. text in the widget.  If you do have this slowdown problem even using
  483. XmTextSetString, unmanage the widget, add the text and then manage it again.
  484. This may cause the window to blink, but you have to put up with that or switch
  485. to a different version of Motif.
  486.  
  487. -----------------------------------------------------------------------------
  488. Subject: 41)  How can I highlight text in the Text widget?
  489.  
  490. Answer: From: argv@zipcode.com (Dan Heller)
  491.  
  492. If you don't need font or color changes, you can do all this using a Text
  493. widget very easily [in Motif 1.1, anyway].
  494.  
  495.         loop() {
  496.             pos = offset_of_pattern_in_text_widget(pattern, text_w);
  497.             search_len = strlen(pattern);
  498.             XmTextSetHighlight(text_w, pos, pos+search_len,
  499.                         XmHIGHLIGHT_SELECTED);
  500.         }
  501.  
  502.  
  503. There are two choices for highlighting: reverse video (HIGHLIGHT_SELECTED) and
  504. underlined (HIGHLIGHT_SECONDARY_SELECTED).  Be careful that your users won't
  505. confuse your highlights with actual selections!
  506.  
  507. -----------------------------------------------------------------------------
  508. Subject: 42)  How can I select all of the text in a widget programmatically?
  509. So that some initial text is displayed, but anything typed replaces it.
  510.  
  511. Answer: XmTextSetSelection(Text1, 0, XmTextGetLastPosition(Text1), event-
  512. >xbutton.time);
  513.  
  514. where Text1 is the widget in question (obviously) and event is some event that
  515. triggered this call.  You can use XtLastTimestampProcessed( display) instead
  516. of xbutton.time if you don't happen to have an event pointer handy.
  517.  
  518.  
  519.  
  520.  
  521. -----------------------------------------------------------------------------
  522. Subject: 43)  How can I change colours of text in the Text widget?  I want
  523. some of the text in one colour, some in another.
  524.  
  525. Answer: You can't.  Text stores an ordinary string, and points where
  526. `highlights' of various types begin and end.  These highlights are all the
  527. control you have over components of the text.  See the previous question.
  528.  
  529.  
  530. -----------------------------------------------------------------------------
  531. Subject: 44)  How can I change the font of text in the Text widget?  I want
  532. some of the text in one font, some in another.
  533.  
  534. Answer: You can't in Text (see the previous question).  If you wanted readonly
  535. text, you could do it by using a label instead.  Label uses XmStrings, which
  536. can contain multiple character sets in the one string.
  537.  
  538. -----------------------------------------------------------------------------
  539. Subject: 45)  Is there an emacs binding for the text widget?
  540.  
  541. Answer: This set is due to Kee Hinckley (nazgul@alfalfa.com):
  542.  
  543. *XmText.translations: #override\n\
  544.         Ctrl <Key>b:            backward-character()\n\
  545.         Alt <Key>b:             backward-word()\n\
  546.         Meta <Key>b:            backward-word()\n\
  547.         Shift Alt <Key>b:       backward-word(extend)\n\
  548.         Shift Meta <Key>b:      backward-word(extend)\n\
  549.         Alt <Key>[:             backward-paragraph()\n\
  550.         Meta <Key>[:            backward-paragraph()\n\
  551.         Shift Alt <Key>[:       backward-paragraph(extend)\n\
  552.         Shift Meta <Key>[:      backward-paragraph(extend)\n\
  553.         Alt <Key><:             beginning-of-file()\n\
  554.         Meta <Key><:            beginning-of-file()\n\
  555.         Ctrl <Key>a:            beginning-of-line()\n\
  556.         Shift Ctrl <Key>a:      beginning-of-line(extend)\n\
  557.         Ctrl <Key>osfInsert:    copy-clipboard()\n\
  558.         Shift <Key>osfDelete:   cut-clipboard()\n\
  559.         Shift <Key>osfInsert:   paste-clipboard()\n\
  560.         Alt <Key>>:             end-of-file()\n\
  561.         Meta <Key>>:            end-of-file()\n\
  562.         Ctrl <Key>e:            end-of-line()\n\
  563.         Shift Ctrl <Key>e:      end-of-line(extend)\n\
  564.         Ctrl <Key>f:            forward-character()\n\
  565.         Alt <Key>]:             forward-paragraph()\n\
  566.         Meta <Key>]:            forward-paragraph()\n\
  567.         Shift Alt <Key>]:       forward-paragraph(extend)\n\
  568.         Shift Meta <Key>]:      forward-paragraph(extend)\n\
  569.         Ctrl Alt <Key>f:        forward-word()\n\
  570.         Ctrl Meta <Key>f:       forward-word()\n\
  571.         Ctrl <Key>d:            kill-next-character()\n\
  572.         Alt <Key>BackSpace:     kill-previous-word()\n\
  573.         Meta <Key>BackSpace:    kill-previous-word()\n\
  574.         Ctrl <Key>w:            key-select() kill-selection()\n\
  575.         Ctrl <Key>y:            unkill()\n\
  576.         Ctrl <Key>k:            kill-to-end-of-line()\n\
  577.         Alt <Key>Delete:        kill-to-start-of-line()\n\
  578.         Meta <Key>Delete:       kill-to-start-of-line()\n\
  579.         Ctrl <Key>o:            newline-and-backup()\n\
  580.         Ctrl <Key>j:            newline-and-indent()\n\
  581.         Ctrl <Key>n:            next-line()\n\
  582.         Ctrl <Key>osfLeft:      page-left()\n\
  583.         Ctrl <Key>osfRight:     page-right()\n\
  584.         Ctrl <Key>p:            previous-line()\n\
  585.         Ctrl <Key>g:            process-cancel()\n\
  586.         Ctrl <Key>l:            redraw-display()\n\
  587.         Ctrl <Key>osfDown:      next-page()\n\
  588.         Ctrl <Key>osfUp:        previous-page()\n\
  589.         Ctrl <Key>space:        set-anchor()\n
  590.  
  591.  
  592. ! If you'd like the Delete key to work like backspace instead of deleting
  593. ! backwards, add the following definition to the lines above.
  594. !       <Key>osfDelete: delete-previous-character()\n\
  595.  
  596. ! These aren't included because they could intefere with
  597. | menu accelerators (or vice versa)
  598. !       Alt <Key>p:             backward-paragraph()\n\
  599. !       Meta <Key>p:            backward-paragraph()\n\
  600. !       Shift Alt<Key>p:        backward-paragraph(extend)\n\
  601. !       Shift Meta<Key>p:       backward-paragraph(extend)\n\
  602. !       Alt <Key>w:             copy-clipboard()\n\
  603. !       Meta <Key>w:            copy-clipboard()\n\
  604. !       Ctrl Alt <Key>w:        cut-clipboard()\n\
  605. !       Ctrl Meta <Key>w:       cut-clipboard()\n\
  606. !       Alt <Key>y:             paste-clipboard()\n\
  607. !       Meta <Key>y:            paste-clipboard()\n\
  608. !       Alt <Key>f:             forward-word()\n\
  609. !       Meta <Key>f:            forward-word()\n\
  610. !       Alt <Key>n:             forward-paragraph()\n\
  611. !       Meta <Key>n:            forward-paragraph()\n\
  612. !       Shift Alt <Key>n:       forward-paragraph(extend)\n\
  613. !       Shift Meta <Key>n:      forward-paragraph(extend)\n\
  614. !       Shift Alt <Key>f:       forward-word(extend)\n\
  615. !       Shift Meta <Key>f:      forward-word(extend)\n\
  616. !       Alt <Key>d:             kill-next-word()\n\
  617. !       Meta <Key>d:            kill-next-word()\n\
  618. !       Alt <Key>h:             select-all()\n\
  619. !       Meta <Key>h:            select-all()\n\
  620.  
  621. Similar sets of translations have been suggested by others.
  622.  
  623. -----------------------------------------------------------------------------
  624. Subject: 46)  How can I use a file as the text source for a Text widget?
  625.  
  626. Answer: You can't do it directly like you can with the Athena Text widget.
  627. Instead, read the text from the file into a string (all of it!) and then use
  628. XmTextSetString.  Alternatively, read blocks of characters and add them at the
  629. end of the text using XmTextInsertString.  The following is an excerpt from
  630. Dan Heller's "file_browser.c":
  631.  
  632.     /* file_browser.c -- use a ScrolledText object to view the
  633.      * contents of arbitrary files chosen by the user from a
  634.      * FileSelectionDialog or from a single-line text widget.
  635.      */
  636.  
  637.     ...
  638.     struct stat statb;
  639.  
  640.     /* make sure the file is a regular text file and open it */
  641.     if (stat(filename, &statb) == -1 ||
  642.             (statb.st_mode & S_IFMT) != S_IFREG ||
  643.             !(fp = fopen(filename, "r"))) {
  644.         if ((statb.st_mode & S_IFMT) == S_IFREG)
  645.             perror(filename); /* send to stderr why we can't read it */
  646.         else
  647.             fprintf(stderr, "%s: not a regular file0, filename);
  648.         XtFree(filename);
  649.         return;
  650.     }
  651.  
  652.     /* put the contents of the file in the Text widget by allocating
  653.      * enough space for the entire file, reading the file into the
  654.      * allocated space, and using XmTextFieldSetString() to show the file.
  655.      */
  656.     if (!(text = XtMalloc((unsigned)(statb.st_size+1)))) {
  657.         fprintf(stderr, "Can't alloc enough space for %s", filename);
  658.         XtFree(filename);
  659.         fclose(fp);
  660.         return;
  661.     }
  662.  
  663.     if (!fread(text, sizeof(char), statb.st_size+1, fp))
  664.         fprintf(stderr, "Warning: may not have read entire file!0);
  665.  
  666.     text[statb.st_size] = 0; /* be sure to NULL-terminate */
  667.  
  668.     /* insert file contents in Text widget */
  669.     XmTextSetString(text_w, text);
  670.  
  671.  
  672.  
  673.  
  674. -----------------------------------------------------------------------------
  675. Subject: 47)  How can put Text in overstrike mode instead of insert?
  676.  
  677. Answer: There is no direct way. This was posted by Edmond Pitt
  678. (ejp@bohra.cpg.oz) The correct answer to the question is to put the following
  679. in a modifyVerify callback, where 'mvcb' is the XmTextVerifyCallbackStruct,
  680. and 'overstriking' is defined by you:
  681.  
  682.     if (overstriking && mvcb->text->length == 1)
  683.     {
  684.         _XmTextDisableRedisplay(w,FALSE);
  685.         XtCallActionProc(w,"delete-next-character",mvcb->event,0);
  686.         _XmTextEnableRedisplay(w);
  687.     }
  688.  
  689. _XmText{Dis,En}ableRedisplay() are XmText{Dis,En}ableRedisplay() in 1.0, but
  690. X11R3 has no XtCallActionProc() anyway. For this environment you need my 1.0.3
  691. Text widget patches posted last year & available on request.
  692.  
  693.  
  694. -----------------------------------------------------------------------------
  695. Subject: 48)  How can I make the Delete key do a backspace?
  696.  
  697. Answer: Put this in your .Xdefaults
  698.  
  699.     *XmText.translations: #override <Key>osfDelete: delete-previous-character()
  700.  
  701.  
  702. -----------------------------------------------------------------------------
  703. Subject: 49)  TOPIC: LIST WIDGET
  704.  
  705. -----------------------------------------------------------------------------
  706. Subject: 50) Should I create an XmList widget as a child of automatic
  707. XmScrolledWindow or use the XmCreateScrolledList() convenience function?
  708.  
  709. Answer: With most implementations, the convenience function use internal hooks
  710. to give somewhat better scrolling performance.  thanks to Ken Lee,
  711. klee@synoptics.com
  712.  
  713. -----------------------------------------------------------------------------
  714. Subject: 51)  How do I best put a new set of items into a list?
  715.  
  716. Answer: Set the new list count and list by XtSetArgs and install them by
  717. XtSetValues.
  718.  
  719.     XmString list[SIZE];
  720.     int list_size;
  721.  
  722.     XtSetArg (args[n], XmNitemCount, list_size); n++;
  723.     XtSetArg (args[n], XmNitems, list); n++;
  724.     XtSetValues (w, args, n);
  725.  
  726. Each time the list is reset by this the old contents are freed by the widget
  727. and the new supplied list is copied.  Do *not* free the old list of items
  728. yourself as this would result in the space being freed twice.  It is not
  729. necessary to remove the items one at a time, nor to "zero" out the list first.
  730.  
  731. -----------------------------------------------------------------------------
  732. Subject: 52)  Can I have strings with different fonts in a list?
  733.  
  734. Answer: Yes. The strings are XmStrings. Each one can be created using a
  735. different character set using a different font.
  736.  
  737.  
  738. -----------------------------------------------------------------------------
  739. Subject: 53)  Can I get a bitmap to show in a list item like I can in a Label?
  740. I want to place a bitmap along with some normal text in my list items.
  741.  
  742. Answer: No. The list contains XmStrings, and these only allow text in various
  743. character sets. The workaround is to define your font containing the icons you
  744. want. Then you can create a fontlist containing your icon font and the font
  745. you want the text in, and then make your items multi-segment XmStrings where
  746. the first segment contains the code of the icon you want with a charset that
  747. matches the icon font in your fontlist and the second segment with a charset
  748. matching the text font.
  749.  
  750.  
  751. -----------------------------------------------------------------------------
  752. Subject: 54)  Can I have items with different colours in a list?
  753.  
  754. Answer: No.  The list contains XmStrings, and these only allow text in various
  755. character sets. Since the items are XmStrings, you can already change the font
  756. of an item by replacing it with an item with the same text and a different
  757. charset tag.  Adding support for color would require modification of the
  758. internal data structure in XmList as well as modification to the drawing
  759. routines.  A possible workaround is to use a rowcolumn of buttons which can be
  760. individually set.  However, you would have to do all list functionality
  761. yourself.
  762.  
  763.  
  764. -----------------------------------------------------------------------------
  765. Subject: 55)  Can I grey out an item in a list?  I want to make insensitive
  766. items in a list so that they cannot be selected.
  767.  
  768. Answer:
  769.  
  770. From W. Scott Meeks of OSF:
  771.  
  772. Unfortunately, you can't do it directly since the list items aren't individual
  773. widgets.  We've had other requests for this technology, but it didn't make the
  774. cut for 1.2; it should be in some future release.
  775.  
  776. However, you can probably fake it in your application with some difficulty.
  777. First, a list item is an XmString, so you can specify a different charset for
  778. the item than for other items in the list and then specify a font in the
  779. list's fontlist that matches the charset and gives you the visual you want.
  780. The next problem is making the item unselectable.  One idea would be to have
  781. the application keep track of the insensitive items and the items currently
  782. selected.  Then you would set up a selection callback that when called would
  783. check the item selected against the list of insensitive items and if the
  784. selected item matched would deselect that item and reselect the previously
  785. selected items.  Otherwise it would just update the application's list of
  786. selected items.  The major drawback with this approach is that you'll get
  787. flashing whenever the list selects an item and your application immediately
  788. de-selects.  Unfortunately I can't think of a way around this without mucking
  789. with the list internals.
  790.  
  791. Another alternative suggested is to use instead a column of say read only text
  792. widgets which you can make insensitive.
  793.  
  794. -----------------------------------------------------------------------------
  795. Subject: 56)  Can I have multi-line items in a list?
  796. [Last modified: August 92]
  797.  
  798. Answer: Motif 1.0 and 1.1 both have problems with multi-line items in a list.
  799. They should work okay in Motif 1.2.
  800.  
  801. -----------------------------------------------------------------------------
  802. Subject: 57)  How can I tell the position of selected items in a list?
  803.  
  804. [Last modified: Oct 92]
  805.  
  806. Answer: From  W. Scott Meeks:
  807.  
  808. 1) All XmList selection callbacks get an XmListCallbackStruct which includes
  809. the item selected and its position.  In addition, the multiple and extended
  810. selection callbacks also get a list of the selected items.  This approach
  811. requires that your application saves this information if you need it outside
  812. of the immediate callback.
  813.  
  814. 2) At any time you can XtGetValues the XmNselectedItems and
  815. XmNselectedItemCount resources.  The problem with this approach is that
  816. identical items may or may not show up in multiple times in this list and the
  817. position in the selectedItems list may not relate directly to the position in
  818. the items list.
  819.  
  820. 3) You can call XmListGetSelectedPos on the list widget.  This will return a
  821. list of the positions of all selected items.
  822.  
  823. -----------------------------------------------------------------------------
  824. Subject: 58)  TOPIC: FILE SELECTION BOX WIDGET
  825.  
  826. -----------------------------------------------------------------------------
  827. Subject: 59)  What is libPW.a and do I need it?  My manual says I need to link
  828. in libPW.a to use the File Selection Box.  I can't find it on my system.
  829.  
  830. Answer: The libPW.a is the Programmers Workbench library which is an ATT
  831. product not included in Berkeley based systems, hence it is not found in SunOS
  832. or Ultrix, but is found on HP-UX (a Berkeley/ATT hybrid which chose ATT in
  833. this case).  It contains the regex(3) routines (regcmp, regex).  Some systems
  834. which don't have these in the libc.a need to link with -lPW.  Some systems
  835. which have the regex(3) routines in there also have the libPW.a.  If you have
  836. regex(3) in libc, and it works, don't link with libPW.  If you don't have
  837. regex(3) in libc, and you don't have a libPW, then check some sites on the net
  838. for public domain replacements (several exist), or call your vendor.
  839.  
  840. In most versions of Motif (see the doco), you can compile FileSB.c with
  841. -DNO_REGEX if you don't have it.
  842.  
  843. -----------------------------------------------------------------------------
  844. Subject: 60)  What are these compile errors: Undefined symbol _regcmp and
  845. _regex?
  846.  
  847. Answer: You need to link in the libPW library - see previous question.
  848.  
  849.  
  850. -----------------------------------------------------------------------------
  851. Subject: 61)  What's wrong with the Motif 1.0 File Selection Box?  I can't set
  852. the directory, change the directory or get the file mask to work.
  853.  
  854. Answer: The 1.0 File Selection Box is broken, and these don't work.  They
  855. weren't fixed until Motif 1.04.  Use these later versions of 1.0 or switch to
  856. Motif 1.1 where it changed a lot.
  857.  
  858. Joe Hildebrand has a work-around for some of this: Before popping up an
  859. XmFileSelectionDialog, change to the directory you want.  When a file is
  860. selected, check if it is a directory, so that we can change to it.  i.e.
  861.  
  862. static void show_file_box_CB(w, client_data, call_data)
  863.    Widget               w;
  864.    Widget               client_data;
  865.    XmAnyCallbackStruct  *call_data;
  866. {
  867.    chdir("/users/hildjj/files");
  868.    XtManageChild(client_data);
  869. }
  870.  
  871. static void val_save(w, client_data, call_data)
  872.    Widget       w;
  873.    Widget       client_data;
  874.    XmSelectionBoxCallbackStruct *call_data;
  875. {
  876.    struct stat buf;  /* struct stat is defined in stat.h */
  877.    char *filename;
  878.  
  879.    /* get the file name from the FileSelectionBox */
  880.    filename = SmX(call_data->value);
  881.  
  882.    /* get the status of the file named filename, and put it into buf */
  883.    if (!stat(filename, &buf))
  884.    {
  885.       /* if it's a directory */
  886.       /* if it's a directory */
  887.       if(S_ISDIR(buf.st_mode))
  888.       {
  889.          /* change to that directory, and update the FileSelectionBox */
  890.         chdir(filename);
  891.         XmFileSelectionDoSearch(w, NULL);
  892.       }
  893.       else
  894.          /* if it's a regular file */
  895.          if(S_ISREG(buf.st_mode))
  896.             /* ask if it should be overwritten */
  897.             XtManageChild(valbox);
  898.          else
  899.             /* it's another kind of file.  What type, i can't think of,
  900.                but it might happen */
  901.             pop_up_error_box(client_data, "Error saving file");
  902.    }
  903.    else  /* we couldn't get the file status */
  904.    {
  905.       /* if it's because the file doesn't exist, we're golden */
  906.       if (errno == ENOENT)
  907.          save_file();
  908.       else   /* there is some other problem getting the status.
  909.                 e.g. bad path */
  910.          pop_up_error_box(client_data, "Error saving file");
  911.    }
  912. }
  913.  
  914. this still doesn't implement the file masking stuff.
  915.  
  916.  
  917. -----------------------------------------------------------------------------
  918. END OF PART TWO
  919. -- 
  920. ..........................
  921.  
  922.